#include "projector.h"
namespace Projector
{


    const unsigned int MAX_PORT = 65535;

    Projector::Projector() :
    mSDCPPort(0),
    mPJLinkPort(0),
    mHttpPort(0),
    mPowerStatusIndex(-1),
    mInputStatusIndex(-1),
    mHasPassword(false),
    mPJLinkV1PW(),
    mHostName(),
    mName(),
    mAddress(),
    mBlackScreen( BLACKSCREEN_Unknown ),
    mInputState(INPUTSTATE_Unknown),
    mPowerState(POWERSTATE_Unknown),
    mProtocolType( PROTOCOLTYPE_Unknown )
{

}

// copy constructor
Projector::Projector(const Projector& orig)
{
    mSDCPPort = orig.mSDCPPort;
    mPJLinkPort = orig.mPJLinkPort;
    mHttpPort = orig.mHttpPort;
    mPowerStatusIndex = orig.mPowerStatusIndex;
    mInputStatusIndex = orig.mInputStatusIndex;
    mHasPassword = orig.mHasPassword;
    mPJLinkV1PW = orig.mPJLinkV1PW;
    mAddress = QHostAddress(orig.mAddress);
    mHostName = orig.mHostName;
    mName = orig.mName;
    mBlackScreen = BLACKSCREEN_Unknown;
    mInputState = INPUTSTATE_Unknown;
    mPowerState = POWERSTATE_Unknown;
    mProtocolType = PROTOCOLTYPE_Unknown;
}

Projector::Projector( unsigned int SDCPPort,unsigned int PJLinkPort,
        unsigned int HttpPort, bool hasPassword, QString& PJLinkV1PW, QString& hostName,
        QString& projName, QHostAddress& address) :
    mSDCPPort(SDCPPort),
    mPJLinkPort(PJLinkPort),
    mHttpPort(HttpPort),
    mPowerStatusIndex(-1),
    mInputStatusIndex(-1),
    mHasPassword(hasPassword),
    mPJLinkV1PW(PJLinkV1PW),
    mHostName(hostName),
    mName(projName),
    mAddress(address),
    mBlackScreen( BLACKSCREEN_Unknown ),
    mInputState(INPUTSTATE_Unknown),
    mPowerState(POWERSTATE_Unknown),
    mProtocolType( PROTOCOLTYPE_Unknown )
{

}


Projector::~Projector()
{

}

QHostAddress const Projector::GetAddress() const
{
    
    return mAddress;
}

void Projector::SetAddress(QHostAddress& address)
{
    mAddress = address;
    return;
}

QString Projector::GetHostName() const
{
    return mHostName;
}

void Projector::SetHostName(QString& hostName)
{
    mHostName = hostName;
    return;
}

unsigned int Projector::GetHttpPort() const
{
    return mHttpPort;
}

void Projector::SetHttpPort(unsigned int port)
{
    
    Q_ASSERT(port <= MAX_PORT);
    mHttpPort = port;
}

InputState Projector::GetInputState() const
{
    return mInputState;
}

void Projector::SetInputState(InputState inputState)
{
    inputState = mInputState;
}

int Projector::GetInputStatusIndex() const
{
    return mInputStatusIndex;
}

void Projector::SetInputStatusIndex(int index)
{
    index = mInputStatusIndex;
}

unsigned int Projector::GetPJLinkPort() const
{
    return mPJLinkPort;
}

void Projector::SetPJLinkPort(unsigned int port)
{
    Q_ASSERT(port <= MAX_PORT);
    mPJLinkPort = port;
}

QString Projector::GetPJLinkV1PW() const
{
    return mPJLinkV1PW;
}

void Projector::SetPJLinkV1PW(QString& password)
{
    mPJLinkV1PW = password;
}

PowerState Projector::GetPowerState() const
{
    return mPowerState;
}

void Projector::SetPowerState(PowerState powerState)
{
    powerState = mPowerState;
    return;
}

int Projector::GetPowerStatusIndex() const
{
    return mPowerStatusIndex;
}

void Projector::SetPowerStatusIndex(int index)
{
    index = mPowerStatusIndex;
    return;
}

QString Projector::GetName() const
{
    
    return mName;
}

void Projector::SetName(QString& projName)
{
    mName = projName;
    return;
}

unsigned int Projector::GetSDCPPort() const
{
    return mSDCPPort;
}

void Projector::SetSDCPPort(unsigned int port)
{
    Q_ASSERT( port <= MAX_PORT );
    mSDCPPort = port;
    return;
}

BlackScreenState Projector::GetBlackScreen() const
{
    return mBlackScreen;
}

void Projector::SetBlackScreen(BlackScreenState blackScreen)
{
    mBlackScreen = blackScreen;
    return;
}

ProtocolType Projector::GetProtocolType() const
{
    return mProtocolType;
}

void Projector::SetProtocolType(ProtocolType protocolType)
{
    mProtocolType = protocolType;
    return;
}

bool Projector::TurnOnOff() const
{
    return true;
}

bool Projector::TurnOn() const
{
    return true;
}

bool Projector::TurnOff() const
{
    return true;
}

bool Projector::CheckPower()
{
    return true;
}

bool Projector::CheckInput()
{
    return true;
}

bool Projector::SwitchInput(QString& input)
{
    return true;
}

bool Projector::CheckBlackScreen()
{
    return true;
}

bool Projector::operator <(const Projector& compare)
{
    return (mName.compare(compare.mName) < 0);
}

}
